package cn.gson.springmvc.model.pojos;

import javax.persistence.*;
import java.math.BigInteger;
import java.util.Collection;
import java.util.Objects;

@Entity
public class Prescriptiondetails {
    private int prescriptionId;
    private String prescriptionMes;
    private String drugDosage;
    private BigInteger isExecution;
    private Presc prescByPrescId;

    @Id
    @Column(name = "prescription_id", nullable = false)
    public int getPrescriptionId() {
        return prescriptionId;
    }

    public void setPrescriptionId(int prescriptionId) {
        this.prescriptionId = prescriptionId;
    }

    @Basic
    @Column(name = "prescription_mes", nullable = true, length = 50)
    public String getPrescriptionMes() {
        return prescriptionMes;
    }

    public void setPrescriptionMes(String prescriptionMes) {
        this.prescriptionMes = prescriptionMes;
    }

    @Basic
    @Column(name = "drug_dosage", nullable = true, length = 10)
    public String getDrugDosage() {
        return drugDosage;
    }

    public void setDrugDosage(String drugDosage) {
        this.drugDosage = drugDosage;
    }

    @Basic
    @Column(name = "is_execution", nullable = true, precision = 0)
    public BigInteger getIsExecution() {
        return isExecution;
    }

    public void setIsExecution(BigInteger isExecution) {
        this.isExecution = isExecution;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        Prescriptiondetails that = (Prescriptiondetails) o;
        return prescriptionId == that.prescriptionId &&
                Objects.equals(prescriptionMes, that.prescriptionMes) &&
                Objects.equals(drugDosage, that.drugDosage) &&
                Objects.equals(isExecution, that.isExecution);
    }

    @Override
    public int hashCode() {
        return Objects.hash(prescriptionId, prescriptionMes, drugDosage, isExecution);
    }



    @ManyToOne
    @JoinColumn(name = "presc_id", referencedColumnName = "presc_id")
    public Presc getPrescByPrescId() {
        return prescByPrescId;
    }

    public void setPrescByPrescId(Presc prescByPrescId) {
        this.prescByPrescId = prescByPrescId;
    }
}
